<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LogDevice API: /Users/chunma/fbsource/fbcode/logdevice/include/Reader.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LogDevice API
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_3c764b8ed47d00d6b5627c49bc32f70b.html">fbsource</a></li><li class="navelem"><a class="el" href="dir_7d108206b339ff559c2aaa41b8fb2672.html">fbcode</a></li><li class="navelem"><a class="el" href="dir_903050bd1b8bae4e85fca6c90c654c58.html">logdevice</a></li><li class="navelem"><a class="el" href="dir_46acbb48b960dc60b3c5450db912a0e4.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Reader.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;chrono&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;folly/Range.h&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;logdevice/include/Record.h&quot;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;logdevice/include/types.h&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacefacebook.html">facebook</a> { <span class="keyword">namespace </span>logdevice {</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">struct </span>ReadStreamAttributes;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classfacebook_1_1logdevice_1_1_reader.html">   35</a></span>&#160;<span class="keyword">class </span><a class="code" href="classfacebook_1_1logdevice_1_1_reader.html">Reader</a> {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a211ad73ea203bf37a65745fe37f63cd1">startReading</a>(logid_t log_id,</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;               lsn_t from,</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;               lsn_t until = LSN_MAX,</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;               <span class="keyword">const</span> ReadStreamAttributes* attrs = <span class="keyword">nullptr</span>) = 0;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a7c5403cffbef361843ebb1344e44e716">stopReading</a>(logid_t log_id) = 0;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#ab7e1afbc25ffe48b1e28f286bef85405">isReading</a>(logid_t log_id) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a1952c5b3d315903c8921e2128919dffa">isReadingAny</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a7fb6f4b893781cea92e959e4626c909b">setTimeout</a>(std::chrono::milliseconds timeout) = 0;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  <span class="keyword">const</span> std::chrono::milliseconds MAX_TIMEOUT{(1LL&lt;&lt;31) - 1};</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;  <span class="keyword">virtual</span> ssize_t <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#abf34b34cad9917ddf748c2dbd2b325da">read</a>(<span class="keywordtype">size_t</span> nrecords,</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;                       std::vector&lt;std::unique_ptr&lt;DataRecord&gt; &gt; *data_out,</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;                       GapRecord *gap_out) = 0;</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a7ef97dd78f6f5c5da4200c6cdfd90d63">waitOnlyWhenNoData</a>() = 0;</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#af1812e18565f35607e5111a053bc6edf">withoutPayload</a>() = 0;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a71fcd2eda3b543ab4190d3c6c69c39a6">forceNoSingleCopyDelivery</a>() = 0;</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a016857a5ec3456b6ef04fc01805510c5">includeByteOffset</a>() = 0;</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a02ec782bdf411227da857eec6c88749f">doNotSkipPartiallyTrimmedSections</a>() = 0;</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a33ec99605bc4516d473f0a449ae319cf">isConnectionHealthy</a>(logid_t) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#ab1c42c7d423374e6fd5072d686d6d557">doNotDecodeBufferedWrites</a>() = 0;</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;  <span class="keyword">static</span> lsn_t <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#ab023b1f6d8a38bcf5bf04609e7a4065b">nextFromLsnWhenStuck</a>(lsn_t stuck_lsn = LSN_INVALID,</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;                                    lsn_t tail_lsn = LSN_INVALID);</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;</div><div class="line"><a name="l00270"></a><span class="lineno"><a class="line" href="classfacebook_1_1logdevice_1_1_reader.html#a489977cdc984156ff8133416a6fae392">  270</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classfacebook_1_1logdevice_1_1_reader.html#a489977cdc984156ff8133416a6fae392">~Reader</a>() { }</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;};</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;}}</div><div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_af1812e18565f35607e5111a053bc6edf"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#af1812e18565f35607e5111a053bc6edf">facebook::logdevice::Reader::withoutPayload</a></div><div class="ttdeci">virtual void withoutPayload()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a211ad73ea203bf37a65745fe37f63cd1"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a211ad73ea203bf37a65745fe37f63cd1">facebook::logdevice::Reader::startReading</a></div><div class="ttdeci">virtual int startReading(logid_t log_id, lsn_t from, lsn_t until=LSN_MAX, const ReadStreamAttributes *attrs=nullptr)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_ab7e1afbc25ffe48b1e28f286bef85405"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#ab7e1afbc25ffe48b1e28f286bef85405">facebook::logdevice::Reader::isReading</a></div><div class="ttdeci">virtual bool isReading(logid_t log_id) const =0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_ab1c42c7d423374e6fd5072d686d6d557"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#ab1c42c7d423374e6fd5072d686d6d557">facebook::logdevice::Reader::doNotDecodeBufferedWrites</a></div><div class="ttdeci">virtual void doNotDecodeBufferedWrites()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a7c5403cffbef361843ebb1344e44e716"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a7c5403cffbef361843ebb1344e44e716">facebook::logdevice::Reader::stopReading</a></div><div class="ttdeci">virtual int stopReading(logid_t log_id)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_abf34b34cad9917ddf748c2dbd2b325da"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#abf34b34cad9917ddf748c2dbd2b325da">facebook::logdevice::Reader::read</a></div><div class="ttdeci">virtual ssize_t read(size_t nrecords, std::vector&lt; std::unique_ptr&lt; DataRecord &gt; &gt; *data_out, GapRecord *gap_out)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html">facebook::logdevice::Reader</a></div><div class="ttdef"><b>Definition:</b> Reader.h:35</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a02ec782bdf411227da857eec6c88749f"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a02ec782bdf411227da857eec6c88749f">facebook::logdevice::Reader::doNotSkipPartiallyTrimmedSections</a></div><div class="ttdeci">virtual void doNotSkipPartiallyTrimmedSections()=0</div></div>
<div class="ttc" id="namespacefacebook_html"><div class="ttname"><a href="namespacefacebook.html">facebook</a></div><div class="ttdef"><b>Definition:</b> AsyncReader.h:17</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_ab023b1f6d8a38bcf5bf04609e7a4065b"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#ab023b1f6d8a38bcf5bf04609e7a4065b">facebook::logdevice::Reader::nextFromLsnWhenStuck</a></div><div class="ttdeci">static lsn_t nextFromLsnWhenStuck(lsn_t stuck_lsn=LSN_INVALID, lsn_t tail_lsn=LSN_INVALID)</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a016857a5ec3456b6ef04fc01805510c5"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a016857a5ec3456b6ef04fc01805510c5">facebook::logdevice::Reader::includeByteOffset</a></div><div class="ttdeci">virtual void includeByteOffset()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a7fb6f4b893781cea92e959e4626c909b"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a7fb6f4b893781cea92e959e4626c909b">facebook::logdevice::Reader::setTimeout</a></div><div class="ttdeci">virtual int setTimeout(std::chrono::milliseconds timeout)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a489977cdc984156ff8133416a6fae392"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a489977cdc984156ff8133416a6fae392">facebook::logdevice::Reader::~Reader</a></div><div class="ttdeci">virtual ~Reader()</div><div class="ttdef"><b>Definition:</b> Reader.h:270</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a1952c5b3d315903c8921e2128919dffa"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a1952c5b3d315903c8921e2128919dffa">facebook::logdevice::Reader::isReadingAny</a></div><div class="ttdeci">virtual bool isReadingAny() const =0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a33ec99605bc4516d473f0a449ae319cf"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a33ec99605bc4516d473f0a449ae319cf">facebook::logdevice::Reader::isConnectionHealthy</a></div><div class="ttdeci">virtual int isConnectionHealthy(logid_t) const =0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a71fcd2eda3b543ab4190d3c6c69c39a6"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a71fcd2eda3b543ab4190d3c6c69c39a6">facebook::logdevice::Reader::forceNoSingleCopyDelivery</a></div><div class="ttdeci">virtual void forceNoSingleCopyDelivery()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_reader_html_a7ef97dd78f6f5c5da4200c6cdfd90d63"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_reader.html#a7ef97dd78f6f5c5da4200c6cdfd90d63">facebook::logdevice::Reader::waitOnlyWhenNoData</a></div><div class="ttdeci">virtual void waitOnlyWhenNoData()=0</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<hr class="footer"/><address class="footer">
<small>
LogDevic API v2.35
</small>
</address>
</body>
</html>
